package cn.vehicle.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 内部的io控制类型
 */
@Getter
@AllArgsConstructor
public enum InternalIOValueEnum {
    UNDEFINED(Integer.MIN_VALUE, "找不到的类型"),
    OFF(0, "断"),
    ON(1, "通"),
    ON_AND_OF(2, "先通后断"),
    ;
    private final int code;
    private final String desc;

    public static InternalIOValueEnum codeOf(Integer code) {
        if (code == null) {
            return null;
        }
        for (InternalIOValueEnum color : values()) {
            if (color.code == code) {
                return color;
            }
        }
        return null;
    }
}
